home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 43
/
Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso
/
Aminet
/
comm
/
www
/
KidHTML1_26.lha
/
KidHTML
/
Script
/
airportcalculator.js
< prev
next >
Wrap
Text File
|
1998-08-25
|
2KB
|
77 lines
<!-- TWO STEPS TO INSTALL AIRPORT:
1. Paste the first code in the HEAD of your HTML document
2. Add the last coding to the BODY of your HTML document -->
<!-- STEP ONE: Paste the first code in the HEAD of your HTML document -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Joe Josey (jjosey@foxberry.net) -->
<!-- Web Site: http://www.foxberry.net/jjosey -->
<!-- This script and many more are available online from -->
<!-- The JavaScript Source!! http://javascriptsource.com -->
<!-- Begin
var Orig=new Array();
var Dest=new Array();
var nm=0;
var tc=0;
function DoCalc(form) {
from_airport=form.from.options[form.from.selectedIndex].value;
dest_airport=form.to.options[form.to.selectedIndex].value;
if (from_airport=="" || dest_airport=="") {
alert("Please enter both an Originating and Destination Airport.");
}
else {
Orig=from_airport.split("/");
Dest=dest_airport.split("/");
d=Math.acos(Math.sin(Orig[2])
*Math.sin(Dest[2])
+Math.cos(Orig[2])
*Math.cos(Dest[2])
*Math.cos(Orig[4]-Dest[4]));
nm=Math.round(3437.747*d);
if (Math.sin(Dest[4]-Orig[4]) < 0) {
tc=Math.acos((Math.sin(Dest[2])
-Math.sin(Orig[2])*Math.cos(d))
/(Math.sin(d)*Math.cos(Orig[2])));
}
else {
tc=2*Math.PI
-Math.acos((Math.sin(Dest[2])
-Math.sin(Orig[2])
*Math.cos(d))/(Math.sin(d)
*Math.cos(Orig[2])));
}
tc=Math.round(tc*(180/Math.PI));
message=(Orig[0] + " to " + Dest[0] + "\n\n");
message+=("Degrees: " +tc+ "\n");
message+=("Nautical Miles: "+nm+"\n");
message+=("Statute Miles: "+Math.round(nm*1.13636)+"\n");
message+=("Kilometers: "+Math.round(nm*1.6094));
alert(message);
}
}
// End -->
</script>
<!-- STEP TWO: Add the last coding to the BODY of your HTML document -->
<BODY>
<center>
<form>
<table width=225 border=1 cellpadding=3>
<tr><td colspan=2><center><font size="+2"><b>Airport Calculator</b></font></center></td></tr>
<tr><td>From:</td><td><select name="from">
<option value="">Originating Airport
<option value="ABQ/1/0.61156/1/1.86064">Albuerque, NM
<option value="ABY/1/0.55039/